using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Deepcode.Flux.Core.Collections;

public partial class Setup_Install_Panels_SetupGeneralInfo : Deepcode.Flux.Core.UI.Abstract.SetupWizardBase
{
	protected override Panel Base_ErrorContainer{ get{ return this.localErrorHost; }}
	protected override Label Base_ErrorLabel { get { return this.localErrors; } }

	protected void Page_Load(object sender, EventArgs e)
	{
	}

	/// <summary>
	/// Form is being populated
	/// </summary>
	/// <param name="settings"></param>
	public override void Initialise(Deepcode.Flux.Core.Collections.BaseDictionary settings)
	{
		base.Initialise(settings);
		// Load field content from the dictionary
		ClientName.Text = settings["ClientName"];
		DefaultMailServer.Text = settings["DefaultMailServer"];
		DefaultFromAddress.Text = settings["DefaultFromAddress"]; 
	}

	/// <summary>
	/// Form is being saved
	/// </summary>
	/// <param name="settings"></param>
	/// <returns></returns>
	public override bool FinishForm(Deepcode.Flux.Core.Collections.BaseDictionary settings)
	{
		string errors = "";
		if (ClientName.Text.Length < 1) errors += "Please specify the installation name<br/>";
		if (DefaultMailServer.Text.Length < 1) errors += "Please specify the default mail server<br/>";
		if (DefaultFromAddress.Text.Length < 1) errors += "Please specify an email address to send from<br/>";
		if (errors != "")
			return DoLocalError(errors);

		settings["ClientName"] = ClientName.Text;
		settings["DefaultMailServer"] = DefaultMailServer.Text;
		settings["DefaultFromAddress"] = DefaultFromAddress.Text;
		return true;
	}
}
